//
//  SmallScrollView.m
//  BeautifulLockerRoom
//
//  Created by mac on 16/7/28.
//  Copyright © 2016年 Winny. All rights reserved.
//

#import "SmallScrollView.h"

@implementation SmallScrollView

-(instancetype)init
{
    self = [super init];
    if (self) {
        self = [[SmallScrollView alloc]initWithFrame:CGRectMake(0, 0, WINDOWWIDTH, 150)];
        self.pagingEnabled = YES;
        [self smallSVChildView];
        self.showsHorizontalScrollIndicator = NO;
    }
    return self;
}
-(void)smallSVChildView
{
    [RequestTool getNetworkRequestWithUrl:ROLLINGURL date:^(NSDictionary *dic)
     {
         NSDictionary * data = [dic objectForKey:@"data"];
         NSArray * items = [data objectForKey:@"items"];
         self.contentSize = CGSizeMake(items.count * WINDOWWIDTH, 0);
         for (int i = 0; i < items.count; i++)
         {
             NSDictionary * item = items[i];
             NSString * pic_url = [item objectForKey:@"pic_url"];
             UIImageView * image = [[UIImageView alloc]initWithFrame:CGRectMake(i * WINDOWWIDTH, 0, WINDOWWIDTH, 150)];
             image.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:pic_url]]];
             [self addSubview:image];
         }
         
     }];
}
@end
